package com.dao;

import com.entity.Td_tblPartyOrgBranchPunish;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface Td_tblPartyOrgBranchPunishDao extends JpaRepository<Td_tblPartyOrgBranchPunish,Integer> {

    /**
     * 查询用户所做出的组织处分记录
     * @param loginId 用户id
     * @param branchName 被处分组织名
     * @param pageable
     * @return 0=id 1=组织名   2=类型
     */
    @Query(value = "select fd_id,fd_beBranchName,fd_type from td_tblPartyOrgBranchPunish where fd_loginId=? and fd_beBranchName LIKE ?",nativeQuery = true)
    public List<Object[]> getByLogin(int loginId, String branchName, Pageable pageable);

    /**
     * 根据id查询某条处分记录
     * @param id
     * @return
     */
    @Query(value = "select * from Td_tblPartyOrgBranchPunish where fd_id=?",nativeQuery = true)
    public Td_tblPartyOrgBranchPunish getByFd_id(int id);
}
